package com.iamdigger.server.job.cron;

import com.iamdigger.server.common.util.PooledHttpClient;
import org.apache.commons.lang3.RandomStringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * Cron Example Job
 * Created by caiweiming on 2016/4/25.
 */
@Component
public class CronExampleJob {

    private static final Logger logger = LoggerFactory.getLogger(CronExampleJob.class);

    public void executeInternal() {
        try {
            String randomStr = RandomStringUtils.random(20, true, true);
            logger.info("Cron Example Job {} execute..", randomStr);
            String osChinaIdxHtml = PooledHttpClient.doGet("http://0x0010.com");
            //logger.debug(osChinaIdxHtml);
            logger.info("Cron Example Job {} accomplished.", randomStr);
        } catch (Exception e) {
            logger.error("Cron example job exception", e);
        }

    }
}
